package org.tacademy.basic.sampletabfragment;

import android.app.Activity;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

public class TabFragment extends Fragment {

	TabFragmentActivity mActivity;
	
	protected void addFragment(TabFragment f) {
		if (mActivity != null) {
			mActivity.addFragmentAtCurrentTab(f);
		}
	}
	
	protected void addFragmentToBackStack(TabFragment f) {
		if (mActivity != null) {
			mActivity.addFragmentStackAtCurrentTab(f);
		}
	}
	
	protected boolean popBackStack() {
		return mActivity.popBackStackAtCurrentTab();
	}
	
	protected void moveFirstFragment() {
		mActivity.moveFirstFragmentAtCurrentTab();
	}
	
	protected void showDialogFragment(DialogFragment f,String tag) {
		f.show(getFragmentManager(),tag);
	}
	
	public void setTabFragmentActivity(TabFragmentActivity activity) {
		mActivity = activity;
	}
	
	public boolean onBackPressed() {
		return false;
	}
}
